{{include file="common@layout/_meta_x-admin" /}}
<body>
{{:widget('common/Common/nav',[array('管理员管理','角色列表')])}}
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">

                {{:widget('common/SearchForm/listSearchFrom',[['beginTime' => $Think.get.beginTime,'endTime' => $Think.get.endTime],
                ['key' => 'name','value' => $Think.get.name,'name' => '角色名'],[]])}}

                <div class="layui-card-header">
                    {{:widget('common/Button/addButton',['添加角色','addRole',[],$permissionStringArray,null,null])}}
                    <span style="float: right">共有数据：<strong id="totalCount">{{$totalCount}}</strong> 条</span>
                </div>
                <div class="layui-card-body layui-table-body layui-table-main">
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
                            <th onclick="clickTableTitle('id','{{$Think.get.orderType == \'desc\' ? \'asc\' : \'desc\' }}')" id="id">ID</th>
                            <th onclick="clickTableTitle('name','{{$Think.get.orderType == \'desc\' ? \'asc\' : \'desc\' }}')" id="name">角色名</th>
                            <th>用户数</th>
                            <th>权限分配</th>
                            <th onclick="clickTableTitle('created_at','{{$Think.get.orderType == \'desc\' ? \'asc\' : \'desc\' }}')" id="created_at">创建时间</th>
                            <th>操作</th>
                        </thead>
                        <tbody>
                        {{volist name="roleList" id="vo"}}
                        <tr>
                            <td>{{$vo.id}}</td>
                            <td>{{$vo.name}}</td>
                            <td>{{$vo.user_count}}</td>
                            <td class="td-status">
                                {{:widget('common/Button/addButton',['分配权限','allocationPermissions',['store_role_id' => $vo[\'id\']],$permissionStringArray,null,null])}}
                            <td>{{$vo.created_at}}</td>
                            <td class="td-manage">
                                {{:widget('common/Button/edit',['editRole',['id' => $vo['id']],$permissionStringArray,null,null])}}
                                {{:widget('common/Button/delete',['delRole',['id' => $vo['id']],$permissionStringArray])}}
                            </td>
                        </tr>
                        {{/volist}}
                        </tbody>
                    </table>
                    <div id = "page">

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

</body>
<script>
    playOrderIcon("{{$Think.get.orderFieldName}}","{{$Think.get.orderType}}");//显示排序图标，注意id为对应列名 onclick="clickTableTitle('id','{{$Think.get.orderType == \'desc\' ? \'asc\' : \'desc\' }}')" id="列名"

    var currentPage = "{{$currentPage}}"
    var limit = "{{$Think.get.pageCount ? $Think.get.pageCount : 10}}"
    layui.use(['laydate','laypage','jquery'], function(){
        var laydate = layui.laydate;
        var laypage = layui.laypage;
        var layer = layui.layer;
        var $ = layui.jquery;
        var totalCount = $("#totalCount").text()
        laypageRender(laypage,$,"",'page','searchForm',limit,totalCount,currentPage);
        laydateRender(laydate,'start');
        laydateRender(laydate,'end');

    });
</script>
